/*eventDispatcher just a namespace to manage event dispatching and listening*/
eventDispatcher = {};

/*controller*/
(function($) {
	// global namespace for triggering and binding events
	$.controller = function(action, command, event ) {
    
		if( !command.execute ){
		      throw 'Wrong parameter';
		}
		
		if( action == "addCommand" ){
			$(eventDispatcher).bind( event, {commandInstance: command}, command.execute);
		}else{
			$(eventDispatcher).unbind( event, {commandInstance: command}, command.execute);
		}

};
})(jQuery);
/* end controller*/